nlp_architect.data.cdc_resources.relations.referent_dict_relation_extraction.ReferentDictRelationExtraction

class nlp_architect.data.cdc_resources.relations.referent_dict_relation_extraction.ReferentDictRelationExtraction(method: nlp_architect.data.cdc_resources.relations.relation_types_enums.OnlineOROfflineMethod = <OnlineOROfflineMethod.ONLINE: 'online'>, ref_dict: str = None)[source]
__init__(method: nlp_architect.data.cdc_resources.relations.relation_types_enums.OnlineOROfflineMethod = <OnlineOROfflineMethod.ONLINE: 'online'>, ref_dict: str = None)[source]

Extract Relation between two mentions according to Referent Dictionary knowledge

Parameters
  • method (optional) – OnlineOROfflineMethod.{ONLINE/OFFLINE} run against full referent dictionary or a sub-set of (default = ONLINE)

  • ref_dict (required) – str Location of referent dictionary file to work with

Methods

__init__(method, ref_dict)

Extract Relation between two mentions according to Referent Dictionary knowledge

extract_all_relations(mention_x, mention_y)

extract_relation(mention_x, mention_y, relation)

Base Class Check if Sub class support given relation before executing the sub class

extract_sub_relations(mention_x, mention_y, …)

Check if input mentions has the given relation between them

get_supported_relations()

Return all supported relations by this class

is_referent_dict(mention_x, mention_y)

Check if input mentions has referent dictionary relation between them

load_reference_dict(dict_fname)

Method to load referent dictionary to memory

extract_all_relations(mention_x: nlp_architect.common.cdc.mention_data.MentionDataLight, mention_y: nlp_architect.common.cdc.mention_data.MentionDataLight) → Set[nlp_architect.data.cdc_resources.relations.relation_types_enums.RelationType][source]
extract_relation(mention_x: nlp_architect.common.cdc.mention_data.MentionDataLight, mention_y: nlp_architect.common.cdc.mention_data.MentionDataLight, relation: nlp_architect.data.cdc_resources.relations.relation_types_enums.RelationType) → nlp_architect.data.cdc_resources.relations.relation_types_enums.RelationType

Base Class Check if Sub class support given relation before executing the sub class

Parameters
  • mention_x – MentionDataLight

  • mention_y – MentionDataLight

  • relation – RelationType

Returns

relation in case mentions has given relation and

RelationType.NO_RELATION_FOUND otherwise

Return type

RelationType

extract_sub_relations(mention_x: nlp_architect.common.cdc.mention_data.MentionDataLight, mention_y: nlp_architect.common.cdc.mention_data.MentionDataLight, relation: nlp_architect.data.cdc_resources.relations.relation_types_enums.RelationType) → nlp_architect.data.cdc_resources.relations.relation_types_enums.RelationType[source]

Check if input mentions has the given relation between them

Parameters
  • mention_x – MentionDataLight

  • mention_y – MentionDataLight

  • relation – RelationType

Returns

relation in case mentions has given relation or

RelationType.NO_RELATION_FOUND otherwise

Return type

RelationType

static get_supported_relations()[source]

Return all supported relations by this class

Returns

List[RelationType]

is_referent_dict(mention_x: nlp_architect.common.cdc.mention_data.MentionDataLight, mention_y: nlp_architect.common.cdc.mention_data.MentionDataLight) → bool[source]

Check if input mentions has referent dictionary relation between them

Parameters
  • mention_x – MentionDataLight

  • mention_y – MentionDataLight

Returns

bool

static load_reference_dict(dict_fname: str) → Dict[str, List[str]][source]

Method to load referent dictionary to memory

Returns

List[RelationType]